var consultCtrl  = new XFApp.client();
XFApp.client.prototype.consult = {
	successCode : "10000",
	urlItems : {
		replyURL : basePath+"/consulation/reply"
	},
	
	reply:function(){
		var replyContent = $("#reply_content").val();
		if(!replyContent){
			$("#reply_tip").show();
			return;
		}
		
		_this = this;
		var id = $("#consulationId").val();
		if(!id){
			webDialogUtil.simpleAlert("请选择需要回答的选项", "温馨提示");
			return;
		}
		var params = {id:id,replyContent:replyContent};
		
		webDialogUtil.simpleConfrimAlert("是否确认答复", function(){
			$.ajax({
				url : _this.urlItems.replyURL,
				dataType : 'json',
				data  : params,
				type : 'post',
				success : function(data) {
					if(data.code!=10000){
						webDialogUtil.simpleAlert(data.msg, "温馨提示");
					}else{
						webDialogUtil.simpleAlert("处理成功", "温馨提示");
						$("#reply_btn").html("修改答复");
					}
				},
				error:function(){
					webDialogUtil.simpleAlert("处理异常，请联系开发人员", "温馨提示");
				}
			});
		}, null, "温馨提示");
	},
	event : function(){
		var _this = this;
		$("#reply_btn").on("click",function(){
			_this.reply();
		});
		$("#reply_content").on("focus",function(){
			$("#reply_tip").hide();
		});
		$("#reply_content").focus();
	},
};
$(function(){
	consultCtrl.consult.event();
});